﻿@using System.Diagnostics
@using Masuit.MyBlogs.Core.Common
@using Masuit.MyBlogs.Core.Models.DTO
@using Masuit.MyBlogs.Core.Models.Enum
@using Masuit.MyBlogs.Core.Models.ViewModel
@using Masuit.Tools
@using Masuit.Tools.Core.Net
@inject Stopwatch stop
@{
    string[] colors = { "success", "info", "warning", "danger", "default" };
    IList<MenuDto> menus = ViewBag.menus;
    UserInfoDto user = Context.Session.Get<UserInfoDto>(SessionKey.UserInfo) ?? new UserInfoDto();
    PageFootViewModel footer = ViewBag.Footer;
}

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>@(ViewBag.Title + "_" + CommonHelper.SystemSettings["Title"])</title>
    <meta name="keywords" content="@(CommonHelper.SystemSettings["Keyword"]+","+ViewBag.Keyword)" />
    <meta name="description" content="@(CommonHelper.SystemSettings["Description"]+","+ViewBag.Keyword)" />
    @Html.Raw(CommonHelper.SystemSettings.GetOrAdd("Styles", ""))
    <link href="https://cdn.staticfile.org/normalize/8.0.1/normalize.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/limonte-sweetalert2/6.11.5/sweetalert2.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/notie/4.3.1/notie.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/animate.css/3.7.0/animate.min.css" rel="stylesheet">
    <link href="~/Content/bootstrap.min.css" rel="stylesheet">
    <link href="~/Assets/layui/css/layui.min.css" rel="stylesheet" />
    <link href="~/fonts/icomoon.min.css" rel="stylesheet" />
    <link href="~/Content/jquery.paging.css" rel="stylesheet" />
    <link href="~/Content/common/reset.css" rel="stylesheet" />
    <link href="~/Content/common/loading.css" rel="stylesheet" />
    <link href="~/Content/common/style.css" rel="stylesheet" />
    <link href="~/Content/common/articlestyle.css" rel="stylesheet" />
    <link href="~/Content/common/leaderboard.css" rel="stylesheet" />
    <link href="~/Content/microtip.min.css" rel="stylesheet" />
    <link href="~/Assets/breadcrumb/style.css" rel="stylesheet" />
    <link href="~/Assets/nav/css/style.css" rel="stylesheet" />
    <link href="~/Assets/tippy/tippy.css" rel="stylesheet" />
    <script src="https://cdn.staticfile.org/bluebird/3.5.3/bluebird.min.js"></script>
    <script src="https://cdn.staticfile.org/jquery/3.4.1/jquery.min.js"></script>
    <script src="https://cdn.staticfile.org/modernizr/2010.07.06dev/modernizr.min.js"></script>
    <script src="https://cdn.staticfile.org/limonte-sweetalert2/6.6.9/sweetalert2.min.js"></script>
    <script src="https://cdn.staticfile.org/platform/1.3.5/platform.min.js"></script>
    <script src="https://cdn.staticfile.org/notie/4.3.1/notie.min.js"></script>
    <script src="https://cdn.staticfile.org/jquery.form/4.2.2/jquery.form.min.js"></script>
    <script src="https://cdn.staticfile.org/jquery-mobile/1.4.5/jquery.mobile.min.js"></script>
    <script src="https://cdn.staticfile.org/linq.js/2.2.0.2/linq.min.js"></script>
    <script src="https://cdn.staticfile.org/wow/1.1.2/wow.min.js"></script>
    <script src="https://cdn.staticfile.org/ifvisible/1.0.6/ifvisible.min.js"></script>
    <script src="https://cdn.staticfile.org/jquery_lazyload/1.9.7/jquery.lazyload.min.js"></script>
    <script src="~/Scripts/bootstrap.min.js"></script>
    <script src="~/Scripts/layer/layer.js"></script>
    <script src="~/Assets/layui/layui.min.js"></script>
    <script src="~/Scripts/bootstrap-suggest.min.js"></script>
    <script src="~/Scripts/jquery.query.js"></script>
    <script src="~/Scripts/jquery.paging.js"></script>
    <script src="~/Scripts/ripplet.js"></script>
    <script src="~/Scripts/global/scripts.js"></script>
    <script src="~/Assets/tippy/tippy.js"></script>
    <script src="~/Assets/newsbox/jquery.bootstrap.newsbox.js"></script>
    <script src="~/Assets/tagcloud/js/tagcloud.js"></script>
    <script src="~/Assets/scrolltop/js/scrolltop.js"></script>
    <script src="~/Assets/nav/js/main.js"></script>
</head>
<body>
    <div id="toc" style="display: none;">
        <a class="close">
            <i class="icon-cross"></i>
        </a>
    </div>
    <div class="sr-only">
        <img src="~/images/hx.png" />
        <img src="~/images/bg1.png" />
        <img src="~/images/bg0.png" />
    </div>
    <div class="header">
        <header class="cd-main-header">
            <a class="cd-logo" href="/"><img src="@CommonHelper.SystemSettings["logo"]" alt="@CommonHelper.SystemSettings["Title"]"><span class="slogan">@CommonHelper.SystemSettings["Slogan"]</span></a>
            <ul class="cd-header-buttons">
                <li><a class="cd-search-trigger" href="#cd-search">搜索<span></span></a></li>
                <li><a class="cd-nav-trigger" href="#cd-primary-nav">菜单<span></span></a></li>
            </ul>
        </header>

        <nav class="cd-nav">
            <ul id="cd-primary-nav" class="cd-primary-nav is-fixed">
                @{
                    if (user.IsAdmin)
                    {
                        <li>
                            <a asp-action="Index" asp-controller="Dashboard" target="_blank">控制面板</a>
                        </li>
                    }
                    var parent = menus.Where(m => m.ParentId == 0);
                    foreach (var m in parent)
                    {
                        if (m.MenuType == MenuType.SubMenu)
                        {
                            <li class="has-children">
                                <a href="#">@m.Name</a>
                                <ul class="cd-secondary-nav is-hidden">
                                    <li class="go-back"><a href="#">上级菜单</a></li>
                                    <li class="see-all"><a asp-controller="Post" asp-action="All">所有 @m.Name</a></li>
                                    @foreach (MenuDto m2 in menus.Where(s => s.ParentId == m.Id).OrderBy(c => c.Sort))
                                    {
                                        if (menus.Any(mm => mm.ParentId == m2.Id))
                                        {
                                            <li class="has-children">
                                                <a href="#">@m2.Name</a>
                                                <ul class="is-hidden">
                                                    <li class="go-back"><a href="#">上级菜单</a></li>
                                                    @foreach (MenuDto m3 in menus.Where(s => s.ParentId == m2.Id).OrderBy(c => c.Sort))
                                                    {
                                                        if (menus.Any(mmm => mmm.ParentId == m3.Id))
                                                        {
                                                            <li class="has-children">
                                                                <a href="#">@m3.Name</a>
                                                                <ul class="is-hidden">
                                                                    <li class="go-back"><a href="#">上级菜单</a></li>
                                                                    @foreach (MenuDto m4 in menus.Where(s => s.ParentId == m3.Id).OrderBy(c => c.Sort))
                                                                    {
                                                                        if (m4.NewTab)
                                                                        {
                                                                            <li><a href="@m4.Url" target="_blank">@m4.Name</a></li>
                                                                        }
                                                                        else
                                                                        {
                                                                            <li><a href="@m4.Url">@m4.Name</a></li>
                                                                        }
                                                                    }
                                                                </ul>
                                                            </li>
                                                        }
                                                        else
                                                        {
                                                            if (m3.NewTab)
                                                            {
                                                                <li><a href="@m3.Url" target="_blank">@m3.Name</a></li>
                                                            }
                                                            else
                                                            {
                                                                <li><a href="@m3.Url">@m3.Name</a></li>
                                                            }
                                                        }
                                                    }
                                                </ul>
                                            </li>
                                        }
                                        else
                                        {
                                            if (m2.NewTab)
                                            {
                                                <li><a href="@m2.Url" target="_blank">@m2.Name</a></li>
                                            }
                                            else
                                            {
                                                <li><a href="@m2.Url">@m2.Name</a></li>
                                            }
                                        }
                                    }

                                </ul>
                            </li>
                        }
                        else if (m.MenuType == MenuType.GalleryMenu)
                        {
                            <li class="has-children">
                                <a href="#">@m.Name</a>
                                <ul class="cd-nav-gallery is-hidden">
                                    <li class="go-back"><a href="#">返回主菜单</a></li>
                                    <li class="see-all"><a asp-controller="Post" asp-action="All">所有 @m.Name</a></li>
                                    @{
                                        var ms = menus.Where(s => s.ParentId == m.Id);
                                        foreach (var mm in ms)
                                        {
                                            if (mm.NewTab)
                                            {
                                                <li>
                                                    <a class="cd-nav-item" href="@mm.Url" target="_blank">
                                                        <img src="@mm.Icon" alt="@mm.Name">
                                                        <h3>@mm.Name</h3>
                                                    </a>
                                                </li>
                                            }
                                            else
                                            {
                                                <li>
                                                    <a class="cd-nav-item" href="@mm.Url">
                                                        <img src="@mm.Icon" alt="@mm.Name">
                                                        <h3>@mm.Name</h3>
                                                    </a>
                                                </li>
                                            }
                                        }
                                    }
                                </ul>
                            </li>
                        }
                        else if (m.MenuType == MenuType.IconMenu)
                        {
                            <li class="has-children">
                                <a href="#">@m.Name</a>
                                <ul class="cd-nav-icons is-hidden">
                                    <li class="go-back"><a href="#">返回主菜单</a></li>
                                    @{
                                        var ms = menus.Where(s => s.ParentId == m.Id);
                                        var step = 1;
                                        foreach (var mm in ms)
                                        {
                                            if (mm.NewTab)
                                            {
                                                <li>
                                                    <a class="cd-nav-item item-@(step++%8)" href="@mm.Url" target="_blank">
                                                        <p>@mm.Name</p>
                                                    </a>
                                                </li>
                                            }
                                            else
                                            {
                                                <li>
                                                    <a class="cd-nav-item item-@(step++%8)" href="@mm.Url">
                                                        <p>@mm.Name</p>
                                                    </a>
                                                </li>
                                            }
                                        }
                                    }
                                </ul>
                            </li>
                        }
                        else
                        {
                            if (m.NewTab)
                            {
                                <li><a href="@m.Url" target="_blank">@m.Name</a></li>
                            }
                            else
                            {
                                <li><a href="@m.Url">@m.Name</a></li>
                            }
                        }
                    }
                }
            </ul>
        </nav>
        <div id="cd-search" class="cd-search">
            <form action="/s" method="get">
                <input type="search" name="wd" placeholder="请在此处输入您想要的任何东西的关键词，支持部分指令：intitle，content，如：intitle:会声会影 content:懒得勤快，指令支持组合">
            </form>
        </div>

        <main class="cd-main-content">
            @RenderBody()
            <div class="cd-overlay"></div>
            <footer class="footer wow fadeIn">
                <div class="container">
                    <span class="counter">总访客量：@CommonHelper.InterviewCount，平均访问量：@(CommonHelper.AverageCount.ToString("N"))人/天，数据耗时：@ViewData["ActionElapsed"]，页面耗时：@(stop.ElapsedMilliseconds)ms</span>
                    <section>
                        友情链接：
                        @{
                            if (user.IsAdmin)
                            {
                                <a asp-controller="Dashboard" asp-action="FileManager" target="_blank">资源管理器</a>
                                <span> | </span>
                                <a href="/taskcenter" target="_blank">任务管理器</a>
                                <span> | </span>
                            }
                            foreach (LinksDto link in footer.Links)
                            {
                                <a href="@link.Url" target="_blank">@link.Name</a>
                                <span> | </span>
                            }
                        }
                        <a asp-controller="Links" asp-action="Index">更多链接>></a>
                    </section>
                    <section class="copy">
                        @Html.Raw(CommonHelper.SystemSettings["Copyright"])
                        @Html.Raw(CommonHelper.SystemSettings.GetOrAdd("Scripts", ""))
                    </section>
                </div>
            </footer>
        </main>
    </div>
    @*loading*@
    <div id="loading">
        <div class="loading1 animated fadeIn">
            <div class="loadEffect">
                @{
                    var num = new Random().StrictNext();
                    for (int i = 0; i < 7; i++)
                    {
                        <div>
                            <span class="bg-@colors[(num+i) % 5]"></span>
                        </div>
                    }
                }
            </div>
        </div>
    </div>
    @*返回顶部火箭*@
    <div style="display: none;" id="rocket-to-top" class="hidden-xs">
        <div style="opacity: 0; display: block;" class="level-2"></div>
        <div class="level-3"></div>
    </div>
    <button type="button" class="btn btn-info btn-sm canvas-close" style="position: fixed;right: 0;bottom: 0;z-index: 200;display: none">不再显示canvas背景</button>
    <script type="text/javascript" color="0,104,183" opacity='1' zIndex="-1" count="100" src="~/Scripts/line.js"></script>
</body>
</html>
@{
    if (Context.Request.Headers["User-Agent"].ToString().Contains(new[] { "IE", "InternetExplorer" }))
    {
        <script type="text/javascript">
            var b = localStorage.getItem("browser");
            if (!b) {
                layer.open({
                    title: '浏览器版本提示',
                    area: '400px;',
                    closeBtn: false,
                    content: '亲爱的访客，我们检测到您正在使用IE浏览器，本网站的某些功能或特性可能不会完美地支持IE浏览器，但您可以继续浏览，不过为了更好的体验效果，建议您使用Chrome、Firefox等相同或类似的更高级浏览器访问本网站。珍惜生命，远离IE！',
                    btn: ['知道了', '哦'],
                    btn1: function (layero) {
                        layer.closeAll();
                        layer.msg('为消灭IE做一点贡献，就是为世界上所有广大的互联网开发者们少加一点儿班做善事！<br/>IE：只要不升级，我还会回来的，我就是这么倔强！', {
                            icon: 5
                        });
                        window.localStorage.setItem("browser", true);
                    },
                    btn2: function (index) {
                    }
                });
            }
        </script>
    }
}
<script>
    (function () {
        var bp = document.createElement('script');
        var curProtocol = window.location.protocol.split(':')[0];
        if (curProtocol === 'https') {
            bp.src = 'https://zz.bdstatic.com/linksubmit/push.js';
        }
        else {
            bp.src = 'http://push.zhanzhang.baidu.com/push.js';
        }
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(bp, s);
    })();
</script>
<script>
    (function (T, h, i, n, k, P, a, g, e) { g = function () { P = h.createElement(i); a = h.getElementsByTagName(i)[0]; P.src = k; P.charset = "utf-8"; P.async = 1; a.parentNode.insertBefore(P, a) }; T["ThinkPageWeatherWidgetObject"] = n; T[n] || (T[n] = function () { (T[n].q = T[n].q || []).push(arguments) }); T[n].l = +new Date(); if (T.attachEvent) { T.attachEvent("onload", g) } else { T.addEventListener("load", g, false) } }(window, document, "script", "tpwidget", "//widget.seniverse.com/widget/chameleon.js"))
</script>
<script>
    tpwidget("init", {
        "flavor": "bubble",
        "location": "WX4FBXXFKE4F",
        "geolocation": "enabled",
        "position": "bottom-left",
        "margin": "10px 10px",
        "language": "zh-chs",
        "unit": "c",
        "theme": "chameleon",
        "uid": "UFC977E1C7",
        "hash": "213ad798bc472dc365da3a9d4a9ff115"
    });
    tpwidget("show");
</script>
<mini-profiler max-traces="5" />